/* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
 *
 * The information contained herein is property of Nordic Semiconductor ASA.
 * Terms and conditions of usage are described in detail in NORDIC
 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
 *
 * Licensees are granted free, non-transferable use of the information. NO
 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
 * the file.
 *
 * $LastChangedRevision$
 */

/** @file
 *
 * @defgroup ble_stack_handler BLE Stack Event Handler
 * @{
 * @ingroup ble_sdk_lib
 * @brief Module for initializing the BLE stack, and propagating BLE stack events to the
 *        application.
 */

#ifndef BLE_STACK_HANDLER_H__
#define BLE_STACK_HANDLER_H__

#include "ble.h"
#include "nrf_sdm.h"

/**@brief Application stack event handler type. */
typedef void (*ble_stack_evt_handler_t) (ble_evt_t * p_ble_evt);

/**@brief Initialize stack handler module.
 *
 * @details Enables the SoftDevice and the BLE stack event interrupt handler.
 *
 * @note This function must be called before calling any function in the SoftDevice API.
 *
 * @param[in]  clock_source            Low frequency clock source to be used by the SoftDevice.
 * @param[in]  ble_stack_evt_handler   Handler to be called for each received BLE stack event.
 * @return     NRF_SUCCESS on successful initialization, otherwise an error code.
 */
uint32_t ble_stack_handler_init(nrf_clock_lfclksrc_t    clock_source,
                                ble_stack_evt_handler_t ble_stack_evt_handler);

#endif // BLE_STACK_HANDLER_H__

/** @} */
